<%@taglib uri="/tags/struts-html" prefix="html"%>
<%@taglib uri="/tags/struts-bean" prefix="bean"%>
<%@taglib uri="/tags/struts-logic" prefix="logic"%>
<%@taglib uri="/tags/struts-layout" prefix="layout"%>
<%
String usuario=(String)session.getAttribute("usr");
 
%> 
<script language="JavaScript" type="text/JavaScript"
	src="../cl/js/jquery-1.5.2.js"></script>
<script language="JavaScript" type="text/JavaScript"
	src="../cl/js/jquery-ui-1.8.11.custom.min.js"></script>
<script language="JavaScript" type="text/JavaScript" src="../cl/js/jquery.validate.js"></script>
<style type="text/css" media="screen">
@import "../cl/css/body.css";
</style>

<style type="text/css" media="screen">
@import "../cl/css/jquery-ui-1.8.11.custom.css";
</style>
<script type="text/javascript" charset="utf-8">
$(function() {
	$( "#datepicker" ).datepicker();
});
</script>
<div id="stylized" class="myform"><html:form
	action="FalloAction">
	<h1>Registrar Incidencia</h1>
	<p><br/></p>
	<label>
		T&eacute;cnico		
	</label>
	<html:select property="codigoEmpleado">
			<html:option value="">Seleccione</html:option> 
			<html:optionsCollection name="FalloForm" property="empleadoList" label="label" value="value" />
	</html:select>
	<br/><br/>
	<label>Tipo falla:</label>
	<html:select property="codigoTipoFalla">
			<html:option value="">Seleccione</html:option> 
			<html:optionsCollection name="FalloForm" property="tipoFallaList" label="nombreTipoFalla" value="codigoTipoFalla" />
	</html:select>
	<br/><br/>
	<label>Fecha falla:</label>
	<html:hidden name="fechaFalla" property="fechaFalla" value=""/>
	<INPUT id="datepicker" name ="datepicker" onChange="document.getElementsByName('fechaFalla')[0].value=this.value;">
	<br/><br/>	
	<label>Descripci&oacute;n:</label>
	<html:hidden name="codigoUsuario" property="codigoUsuario" value="<%=usuario%>"/>
	<html:textarea property="descripcion"></html:textarea>	
	<html:hidden property="codigoEstado" value="1"/>
	<br/><br/>
	<html:hidden name="parameter" property="a" value="Agregar"></html:hidden>
   <html:submit value="Agregar" />
   <br/><br/>
</html:form></div>

<script type="text/javascript" charset="utf-8">
	//funcion para validar el form 
	document.getElementsByName('FalloForm')[0].id="iFalloForm";
	$(document).ready(function() {
		$("#iFalloForm").validate({
			rules: {
			codigoEmpleado: {
			  required: true
			},
			codigoTipoFalla: {
			  required: true
			},
			descripcion:{
				required: true,
				maxlength: 100
				},
			datepicker: {
				required: true,
				date:true
			}	
		  }
		});
	});
</script>